[iphone] method created in a seperate class returns "out of scope"

Posted by Dror Sabbag on Stack Overflow See other posts from Stack Overflow or by Dror Sabbag
Published on 2010-05-18T17:33:20Z Indexed on 2010/05/18 17:40 UTC
Read the original article Hit count: 172

Filed under:
|
|
|
|

Hey,

I have created a Class (subclass of NSObject) which will hold all my SQLs/dbConnections etc..

in a seperate viewcontroller, i have instantiated the SQL's class and performed some actions, all went trough OK.

but. one of my methods in the SQL's class is a method defined as follows:

-(NSString *)queryTable:(NSUInteger *)fieldnum
        //query from db, and assign the field value into "fieldName"

        dbEntity = fieldName;
        [fieldName release];

       }
       sqlite3_finalize(statement);
   } 
   return dbEntity;
}

dbEntity is defined as NSString, and i have set it as a nonatoimc-retain property

@property (nonatomic,retain) NSString *dbEntity;

when ever i call this method out from my viewController and debug step by step, i see that the method is running, it is quering from the db as expected, but when it passes the value into dbEntity the values in dbEntity are suddenly "out of scope" that is... if i browse this specific action:

dbEntity = fieldName; 

i can see values inside fieldName, but see "out of scope" in dbEntity.

Why is that?!?

what is wrong with dbEntity definitions?

Any help will be appriciated.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about classes